<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>数组求和、数组最大值</title>
	</head>
	<body>
		<script>
			var arr=[1,2,3,4,5,6,7,8];
			var sum=0;
			for(var i=0;i<arr.length;i++){
				sum+=arr[i];
			}
			console.log(sum);
			var num=Number.MIN_VALUE;
			for(var i=0;i<arr.length;i++){
				if(arr[i]>num){
					num=arr[i];
				}
			}
			console.log(num);
		</script>
	</body>
</html>
